/*eslint-disable*/
import React from "react";
// nodejs library that concatenates classes
import classNames from "classnames";
// @material-ui/core components
import { makeStyles } from "@material-ui/core/styles";
import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
// @material-ui/icons
import Favorite from "@material-ui/icons/Favorite";
// core components
import Header from "pages-components/Header/Header.js";
import HeaderLinks from "pages-components/Header/HeaderLinks.js";
import Parallax from "components/Parallax/Parallax.js";
import GridContainer from "components/Grid/GridContainer.js";
import GridItem from "components/Grid/GridItem.js";
import Footer from "components/Footer/Footer.js";
// sections for this page

import SectionWrite from "pages-components/sections/SectionWrite.js";
import SectionFeatures from "pages-components/sections/SectionFeatures.js";

import pricingStyle from "assets/jss/nextjs-material-kit-pro/pages/pricingStyle.js";
import { getCookie } from "redux/api/cookie";
import { Creators as AuthCreators } from "redux/actions/auth";
import { END } from "redux-saga";
import { wrapper } from "redux/store";

const useStyles = makeStyles(pricingStyle);

export default function PricingPage({ token }) {
  React.useEffect(() => {
    window.scrollTo(0, 0);
    document.body.scrollTop = 0;
  });
  const classes = useStyles();
  return (
    <div>
      <Header
        brand="YaK企业数字化转型研究所"
        links={<HeaderLinks dropdownHoverColor="info" />}
        fixed
        color="transparent"
        changeColorOnScroll={{
          height: 300,
          color: "info",
        }}
      />
      <Parallax image={require("assets/img/bg2.jpg")} filter="dark" small>
        <div className={classes.container}>
          <GridContainer>
            <GridItem
              md={8}
              sm={8}
              className={classNames(
                classes.mlAuto,
                classes.mrAuto,
                classes.textCenter
              )}
            >
              <h1 className={classes.title}>分享您的见解或提出您的困惑</h1>
              <h4>
                在这里，集思广义，分享您的见解，记录您的心得体会，也可以提出您的困惑，大家一起讨论
              </h4>
            </GridItem>
          </GridContainer>
        </div>
      </Parallax>
      <div className={classNames(classes.main, classes.mainRaised)}>
        <div className={classes.container}>
          <SectionWrite token={token} />
          <hr />
          <SectionFeatures />
        </div>
      </div>
      <Footer
        content={
          <div>
            <div className={classes.left}>
              <List className={classes.list}>
                <ListItem className={classes.inlineBlock}>
                  <a
                    href="https://www.oxyak.com:8080/index.html"
                    target="_blank"
                    className={classes.block}
                  >
                    YaK
                  </a>
                </ListItem>
                <ListItem className={classes.inlineBlock}>
                  <a
                    href="https://www.oxyak.com:8080/index.html"
                    target="_blank"
                    className={classes.block}
                  >
                    关于
                  </a>
                </ListItem>
                <ListItem className={classes.inlineBlock}>
                  <a
                    href="https://www.oxyak.com:8080/index.html"
                    className={classes.block}
                  >
                    博客
                  </a>
                </ListItem>
                <ListItem className={classes.inlineBlock}>
                  <a
                    href="https://www.oxyak.com:8080/index.html"
                    target="_blank"
                    className={classes.block}
                  >
                    隐私政策
                  </a>
                </ListItem>
              </List>
            </div>
            <div className={classes.right}>
              &copy; {1900 + new Date().getYear()} 沪ICP备17029056号{" "}
              <Favorite className={classes.icon} />{" "}
              <a href="https://www.oxyak.com:8080/index.html" target="_blank">
                YaK
              </a>{" "}
              服务于企业数字化转型.
            </div>
          </div>
        }
      />
    </div>
  );
}

PricingPage.getInitialProps = async (ctx) => {
  //   console.log("ctx====>", ctx);
  const { store, req } = ctx;
  const token = getCookie("access_token", req);
  store.dispatch(AuthCreators.getCheckAuth({ token: token }));
  store.dispatch(END);
  await store.sagaTask.toPromise();
  return { token };
};
